package com.blocks.mq.listener.example.service;

import org.springframework.stereotype.Service;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @author lxd
 * @date 2020/12/5 9:46
 */
@Service
public class ExampleTxtWriterService {

    public void writeTxt(String data, String path) {
        path = path + "-receive.txt";
        try (BufferedWriter bw = new BufferedWriter(new FileWriter(path))) {
            bw.write(data);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
